|
|
|
|
|
|
|
The FormShow procedure is very simple. It just takes the data directly from the module-level recordset and moves it into the text boxes: |
|
|
|
 |
|
|
|
|
Private Sub FormShow()
mboolShow = True
With moRS
txtFirst = Field2Str(!sFirst_nm)
txtLast = Field2Str(!szLast_nm)
txtAddress = Field2Str(!szStreet1_ad)
txtCity = Field2Str(!szCity_nm)
Call ListFindItem(cboStates, Field2Long(!lState_id))
txtZip = Field2Str(!sZip_cd)
txtPhone = Field2Str(!sPhone_no)
txtSSN = Field2Str(!sSSN_tx)
txtBirthDate = Field2Str(!dtBirth_dt)
txtSalary = Field2Str(!cSalary_amt)
If !sSex_Type = "M" Then
optMale.Value = True
Else
optFemale.Value = True
End If
chkHealth.Value = Field2CheckBox(!boolHealth_fl)
chk401k.Value = Field2CheckBox(!bool401k_fl)
chkBonus.Value = Field2CheckBox(!boolBonus_fl)
End With
mboolShow = False
End Sub |
|
|
|
|
|
|
|
|
In the FormShow procedure is another module-level variable called mboolShow that you set to a True value. This variable is used to stop the Change events in the text boxes from firing when you load the data from the recordset into the text boxes. |
|
|
|
|
|
|
|
|
A couple other routines are used to convert possible Null values into blank strings so that they can be loaded into the text boxes. Whenever you retrieve data from a field in a database, you need to check to see whether it is Null. If it is, you have to convert it into a valid value prior to loading it into a control. Now, lets look at the Field2Str() function. |
|
|
|
|
|